import type { OrderCreateParams, OrderPreResult } from '@/types/order'
import type { OrderResult } from '@/types/orderDetails'
import type { BaseProfile, ProfileDetail, ProfileParams } from '@/types/userInfo'
import { http } from '@/utils/http'
/**
 * 获取个人信息
 */
export const getUserInfo = () => {
  return http<BaseProfile>({
    method: 'GET',
    url: '/member/profile',
  })
}

//修改个人信息
export const modifyUserInfo = (data: ProfileParams) => {
  return http<ProfileDetail>({
    method: 'PUT',
    url: '/member/profile',
    data,
  })
}
//提交订单
export const postOrder = (data: OrderCreateParams) => {
  return http<{ id: string }>({
    method: 'POST',
    url: '/member/order',
    data,
  })
}

//获取订单详情
export const getOrderDetailApi = (id: string) => {
  return http<OrderResult>({
    method: 'GET',
    url: `/member/order/${id}`,
  })
}
